<template>
	<view class="">
		<view class="">
			<view class="cu-list menu margin-tb-sm">
				<view class="cu-item arrow" @click="goSearchFillmachine">
					<view class="content">
						<text class="text-black">加注机</text>
					</view>
					<view class="action" >
						<text class="text-blue text-sm">选择加注机</text>
					</view>
				</view>
			</view>
			<view class="cu-bar bg-white">
				<view class="action">
					反馈内容
				</view>
			</view>
			<view class='bg-white padding-lr-sm margin-bottom-lg textareaBox'>
				<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaAInput" placeholder="请输入反馈内容"></textarea>
			</view>
			<view class="btn-common">
				<button class="cu-btn margin-bottom-xl block bg-blue" style="padding: 40rpx 0;" @click="submints">提交</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				machineList:[],
				macCode:'',
				acts:0,
				macId:'',
				mobile:'',
				desc:''
			}
		},
		onLoad() {
			this.getfillmachineList()
		},
		methods:{
			goSearchFillmachine(){
				uni.navigateTo({
					url:'/pages/search/fillmachine?from=question'
				})
			},
			getfillmachineList(){
				let _this = this;
				let data = {
					teamId: uni.getStorageSync('teamid'),
				}
				this.https.fillmachineList().then(res=>{
					_this.machineList = res.data.data.records;
				}).catch(err=>{
					console.log(err)
					_this.toastTip(err.data.msg)
				})
			},
			PickerChange(e){
				console.log(e)
				this.macCode = this.machineList[e.detail.value].macCode
				this.macId = this.machineList[e.detail.value].id
			},
			submints(){
				let _this = this;
				if(!this.macCode){
					this.toastTip('请选择加注机')
					return
				}
				if(!this.mobile){
					this.toastTip('请输入手机号')
					return
				}
				if(!this.desc){
					this.toastTip('请输入故障描述')
					return
				}
				let data = {
					machineId:_this.id,
					remark:_this.desc,
					faultCode:10001,
					mobile:_this.mobile
				}
				this.https.fillmachinefeedback(data).then(res=>{
					_this.toastTip('操作成功')
					
					setTimeout(function() {
						uni.navigateBack({
							delta:1
						})
					}, 1500);
				}).catch(err=>{
					console.log(err)
					_this.toastTip(err.data.msg)
				})
			}
		},
		
	}
</script>

<style lang="scss" scoped>
	page{
		background: #F5F5F5;
		.textareaBox{
			display:block;
			width:750rpx;
			padding:20rpx;
			overflow: hidden;
			background: white;
			textarea{
				background: #F5F5F5;
				width:710rpx;
				padding:20rpx;
			}
		}
		
	}
</style>